uniform float3 lightPosEye; // light position in eye space
uniform sampler2D shadowTex;

varying vec4 vertexPosEye;  // vertex position in eye space
varying vec3 normalEye;
void main()
{
    vec3 a = {2, 2, 2};
    vec4 shadowPos = gl_TextureMatrix[0] * vertexPosEye;

    vec3 N = normalize(normalEye);
    vec3 L = normalize(lightPosEye - vertexPosEye.xyz);
    float diffuse = max(0.0, dot(N, L));

    float shadow = 1.0 - texture2DProj(shadowTex, shadowPos.xyw).x;
//    shadow = 0.5 + 0.5*shadow;

    gl_FragColor = gl_Color * diffuse * shadow;
}